﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApiTest.aspx.cs" Inherits="ShareMarking.Api.ApiTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>api接口测试</title>
  <%--  <script src="js/jquery.min.js" type="text/javascript"></script>--%>
    <script src="js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <link href="js/Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
   <form id="form1" runat="server">
   <div style="width:1400px;height:100px;clear:both;margin:0 auto; background:#FFF;">  
   <h2>+号替换" "</h2>
        <asp:TextBox ID="请输入参数" style="width:600px; height:50px" runat="server" Text="access_id=accessuser_ecrm&method=getqrbysceneid&timestamp=1455599344000&sceneid=12881"></asp:TextBox>
        <asp:Button ID="Button1" style=" width:150px; height:50px" runat="server" Text="生成签名" onclick="Button1_Click" />
        <asp:Label ID="Label1" style=" width:150px; height:50px; color:Red;" runat="server" Text="签名值"></asp:Label>
       </div> 
    <div id="wrap" style=" display:none;">    
    
       <div id="left_a">   
          <input class="btn" id="btn_submit" type="button" value="API医院列表"/>  
          <span>返回&nbsp;<span id="HCount" class="count"></span>&nbsp;条医院数据</span>
          <div class="hcontent" id="hinfo"> </div>
       </div>   
  
       <div id="right_a">   
           <input class="btn" id="btn_submit2" type="button" value="APIPNR列表"/>
           <span>返回&nbsp;<span id="PCount" class="count"></span>&nbsp;条PNR数据</span>
           <div class="pcontent" id="pinfo"></div>
      </div>  
        
       <div class="clear"></div>   
       
        
</div>   
</form>

<script type="text/javascript">
    $("#btn_submit").click(submit);
    $("#btn_submit2").click(submit2);
    function submit() {
        var sum = "";
        $.getJSON("api.ashx?action=gethospqrlist2", function (data) {
            $("#hinfo").html(""); //清空info内容
            var res = eval(data);
            $.each(res.result, function (i, item) {
                if (typeof item == "object") {
                    $.each(item, function (j, list) {
                        $("#hinfo").append(
                        "<div class=\"count\">" + "第" + j + "条" + "</div>" +
                        "<div>" + list.hospid + "</div>" +
                        "<div>" + list.hospname + "</div>" +
                        "<div>" + list.code_url + "</div>" +
                         "<div>" + list.qrcode_url + "</div>" +
                        "<hr/>");
                    });
                } else {
                    //sum = item;
                }
                sum = item; //item.length;
            });
            if (sum == "0") {
                $("#hinfo").append(
                        "<div class=\"count\">" + "暂无修改的数据。" + "</div>");
            }
            document.getElementById("HCount").innerHTML = parseInt(sum);
        });

    }
    function submit2() {
        var sum = 0;
        $.getJSON("api.ashx?action=getpnrqrlist2", function (data) {
            $("#pinfo").html(""); //清空info内容
            var res = eval(data);
            $.each(res.result, function (i, item) {
                if (typeof item == "object") {
                    $.each(item, function (j, list) {
                        $("#pinfo").append(
                        "<div class=\"count\">" + "第" + j + "条" + "</div>" +
                        "<div>" + list.pnrid + "</div>" +
                        "<div>" + list.pnrname + "</div>" +
                        "<div>" + list.code_url + "</div>" +
                         "<div>" + list.qrcode_url + "</div>" +
                        "<hr/>");
                    });
                }
                sum = item;
            });
            if (sum == "0") {
                $("#pinfo").append(
                        "<div class=\"count\">" + "暂无修改的数据。" + "</div>");
            }
            document.getElementById("PCount").innerHTML = parseInt(sum);
        });
    }
</script>
</body>
</html>
